//
//  ArtistView.m
//  花花时尚
//
//  Created by zhang on 15/10/7.
//  Copyright (c) 2015年 ggs. All rights reserved.
//

#import "ArtistView.h"
#import "VideoMode.h"
#import "ArtistModel.h"
#import "Define.h"
#import "UIImageView+WebCache.h"
#import "ArtistImageView.h"


@interface ArtistView ()
@property (nonatomic, retain)UIImageView *pic;
@property (nonatomic, retain)UIVisualEffectView *visual;
@property (nonatomic, retain)UILabel *regdate;
@property (nonatomic, retain)UILabel *artistName;
@property (nonatomic, retain)UILabel *totalVIews;
@property (nonatomic, retain)UILabel *totalPcViews;
@property (nonatomic, retain)UILabel *totalMobileViews;
@property (nonatomic, retain)UITextView *descriptions;

@end
@implementation ArtistView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatView];
    }
    return self;
}
- (void)creatBLur
{
    self.pic = [[UIImageView alloc] initWithFrame:self.frame];
    [self addSubview:_pic];
    [_pic release];
    
    self.visual = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
    self.visual.frame = self.frame;
    [_pic addSubview:self.visual];
    [self.visual release];
}
- (void)creatView
{
    self.headPic = [[ArtistImageView alloc] initWithFrame:CGRectMake(10 * REAL_WIDTH, 10 * REAL_HEIGTH, 60 * REAL_WIDTH, 60 * REAL_HEIGTH)];
    self.headPic.layer.cornerRadius = self.frame.size.width / 2;
    self.headPic.layer.masksToBounds = YES;
    self.headPic.layer.cornerRadius = 30;
    //    self.headPic.image = [UIImage imageNamed:@"1.jpg"];
    self.headPic.backgroundColor = [UIColor blackColor];
    [self addSubview:self.headPic];
    [self.headPic release];
    
    
    UILabel *artistLab = [[UILabel alloc] initWithFrame:CGRectMake(self.headPic.frame.origin.x + self.headPic.frame.size.width + 10 * REAL_WIDTH, self.headPic.frame.origin.y + 15 * REAL_HEIGTH, 50 * REAL_WIDTH, 15 * REAL_HEIGTH)];
    //    artistLab.backgroundColor = [UIColor yellowColor];
    artistLab.text = @"艺人 :";
    artistLab.textColor = [UIColor whiteColor];
    [self addSubview:artistLab];
    [artistLab release];
    
    self.artistName = [[UILabel alloc] initWithFrame:CGRectMake(artistLab.frame.origin.x, artistLab.frame.origin.y + artistLab.frame.size.height + 10 * REAL_HEIGTH, 150 * REAL_WIDTH, artistLab.frame.size.height)];
    //    self.artistName.backgroundColor = [UIColor blackColor];
    self.artistName.textColor = [UIColor whiteColor];
    [self addSubview:self.artistName];
    [self.artistName release];
    
    self.regdate = [[UILabel alloc] initWithFrame:CGRectMake(self.headPic.frame.origin.x, self.headPic.frame.origin.y + self.headPic.frame.size.height + 5 * REAL_HEIGTH, 200 * REAL_WIDTH, artistLab.frame.size.height)];
    //    self.regdate.backgroundColor = [UIColor yellowColor];
    self.regdate.textColor = [UIColor whiteColor];
    [self addSubview:self.regdate];
    [self.regdate release];
    
    UILabel *allLab = [[UILabel alloc] initWithFrame:CGRectMake(self.headPic.frame.origin.x, self.regdate.frame.origin.y + self.regdate.frame.size.height + 5 * REAL_HEIGTH, 80 * REAL_WIDTH, 15 * REAL_HEIGTH)];
    allLab.text = @"播放次数:";
    allLab.textColor = [UIColor whiteColor];
    [self addSubview:allLab];
    [allLab release];
    
    self.totalVIews = [[UILabel alloc] initWithFrame:CGRectMake(allLab.frame.origin.x + allLab.frame.size.width, allLab.frame.origin.y, 50 * REAL_WIDTH, 15 * REAL_HEIGTH)];
    self.totalVIews.backgroundColor = [UIColor blackColor];
    self.totalVIews.font = [UIFont systemFontOfSize:13];
    self.totalVIews.textColor = TEXT_COLOR;
    [self addSubview:self.totalVIews];
    [self.totalVIews release];
    
    UILabel *PCLab = [[UILabel alloc] initWithFrame:CGRectMake(self.totalVIews.frame.origin.x + self.totalVIews.frame.size.width + 5 * REAL_WIDTH, self.totalVIews.frame.origin.y, 50 * REAL_WIDTH, self.artistName.frame.size.height)];
    PCLab.text = @"PC端:";
    PCLab.textColor = [UIColor whiteColor];
    [self addSubview:PCLab];
    [PCLab release];
    
    self.totalPcViews = [[UILabel alloc] initWithFrame:CGRectMake(PCLab.frame.origin.x + PCLab.frame.size.width, PCLab.frame.origin.y, 50 * REAL_WIDTH, PCLab.frame.size.height)];
    self.totalPcViews.font = [UIFont systemFontOfSize:13];
    self.totalPcViews.textColor = TEXT_COLOR;
    //    self.totalPcViews.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.totalPcViews];
    [self.totalPcViews release];
    
    UILabel *phoneLab = [[UILabel alloc] initWithFrame:CGRectMake(self.totalPcViews.frame.origin.x + self.totalPcViews.frame.size.width + 5 * REAL_WIDTH, self.totalPcViews.frame.origin.y, 60 * REAL_WIDTH, self.totalPcViews.frame.size.height)];
    phoneLab.text = @"移动端:";
    phoneLab.textColor = [UIColor whiteColor];
    [self addSubview:phoneLab];
    [phoneLab release];
    
    self.totalMobileViews = [[UILabel alloc] initWithFrame:CGRectMake(phoneLab.frame.size.width + phoneLab.frame.origin.x, phoneLab.frame.origin.y, 50 * REAL_WIDTH, phoneLab.frame.size.height)];
    //    self.totalMobileViews.backgroundColor = [UIColor redColor];
    self.totalMobileViews.font = [UIFont systemFontOfSize:13];
    self.totalMobileViews.textColor = TEXT_COLOR;
    [self addSubview:self.totalMobileViews];
    [self.totalMobileViews release];
    
    self.descriptions = [[UITextView alloc] initWithFrame:CGRectMake(self.headPic.frame.origin.x, self.totalMobileViews.frame.origin.y + self.totalMobileViews.frame.size.height + 30 * REAL_HEIGTH, SCREEN_WIDTH - 30 * REAL_WIDTH, 150 * REAL_HEIGTH) textContainer:nil];
    self.descriptions.backgroundColor = [UIColor blackColor];
    self.descriptions.font = [UIFont systemFontOfSize:17];
    self.descriptions.textColor = [UIColor whiteColor];
    self.descriptions.editable = NO;
    [self addSubview:self.descriptions];
    [self.descriptions release];
}

- (void)setvalueWith:(VideoMode *)Video artist:(ArtistModel *)artist
{
    [self.headPic sd_setImageWithURL:[NSURL URLWithString:artist.artistAvatar] placeholderImage:[UIImage imageNamed:@"head_holder.png"]];
    [self.pic sd_setImageWithURL:[NSURL URLWithString:artist.artistAvatar]];
    self.totalMobileViews.text = [NSString stringWithFormat:@"%@", Video.totalMobileViews];
    self.totalPcViews.text = [NSString stringWithFormat:@"%@", Video.totalPcViews];
    self.totalVIews.text = [NSString stringWithFormat:@" %@", Video.totalViews];
    self.descriptions.text = [NSString stringWithFormat:@"描述: %@", Video.descriptions];
    self.regdate.text = Video.regdate;
    self.artistName.text = artist.artistName;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
